import { Ellipsoid, Rectangle, WebMercatorProjection } from "cesium";

export default class MyRectangle extends Rectangle {

    public getSizeInMercator(): number {
        // 创建WebMercator投影
        const projection = new WebMercatorProjection(Ellipsoid.WGS84);
        const northeast = projection.project(Rectangle.northeast(this));
        const southwest = projection.project(Rectangle.southwest(this));
        // 计算矩形在墨卡托坐标系下的宽度和高度
        const width = northeast.x - southwest.x;
        const height = northeast.y - southwest.y;
        return width * height
    }

    // public static fromDegrees(size: number): MyRectangle {

    // }
}